package com.bwie.system.service.impl;

import com.bwie.common.domain.YouXiang;
import com.bwie.system.mapper.YouXiangMapper;
import com.bwie.system.service.YouXiangService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class YouXiangServiceImpl implements YouXiangService {


    @Autowired
    YouXiangMapper youXiangMapper;
    @Autowired
    RedisTemplate redisTemplate;
    @Override
    public PageInfo<YouXiang> xianglist(YouXiang youXiang) {
        PageHelper.startPage(youXiang.getPageNum(),youXiang.getPageSize());
     List<YouXiang> youXiangs= youXiangMapper.xianglist(youXiang);
        PageInfo<YouXiang> youXiangPageInfo = new PageInfo<>(youXiangs);
//        redisTemplate.opsForList().rightPushAll("youxiang",youXiangs);
        return youXiangPageInfo;
    }

    @Override
    public PageInfo<YouXiang> xianglistsss(YouXiang youXiang) {
        PageHelper.startPage(youXiang.getPageNum(),youXiang.getPageSize());
        List<YouXiang> youXiangss= youXiangMapper.xianglists(youXiang);
        PageInfo<YouXiang> youXiangPageInfos = new PageInfo<>(youXiangss);

        return youXiangPageInfos;
    }

    @Override
    public PageInfo<YouXiang> xianglistsses(YouXiang youXiang) {
        PageHelper.startPage(youXiang.getPageNum(),youXiang.getPageSize());
        List<YouXiang> youXiangses= youXiangMapper.xianglistes(youXiang);
        PageInfo<YouXiang> youXiangPageInfoes = new PageInfo<>(youXiangses);

        return youXiangPageInfoes;
    }

    @Override
    public PageInfo<YouXiang> xianglistx(YouXiang youXiang) {
        PageHelper.startPage(youXiang.getPageNum(),youXiang.getPageSize());
        List<YouXiang> youXiangsesx= youXiangMapper.xianglistesx(youXiang);
        PageInfo<YouXiang> youXiangPageInfoesx = new PageInfo<>(youXiangsesx);

        return youXiangPageInfoesx;
    }
}
